package top.drinyeit.weilong.activity;

import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import org.json.JSONException;
import org.json.JSONObject;

import top.drinyeit.weilong.R;
import top.drinyeit.weilong.base.BaseActivity;
import top.drinyeit.weilong.presenter.AppraisePresenter;

/**
 * Created by wu on 2018/1/20.
 */

public class AppraiseActivity extends BaseActivity {
    String childrenOrderId;
    public RecyclerView recyclerView;
    private AppraisePresenter appraisePresenter;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_evalation);

        initView();
        initIntent();
        initData();
    }

    private void initView() {
        setToolbar2(true, "发表评价");
        recyclerView = findViewById(R.id.rv_evalation);
        TextView order = findViewById(R.id.tv_order);
        order.setVisibility(View.VISIBLE);

        order.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                appraisePresenter.orderAppraise();
            }
        });
    }

    private void initIntent() {
        if (getIntent() == null) {
            showToast("请检查网络设置");
        } else {
            childrenOrderId = getIntent().getExtras().getString("children_order_id");
        }
    }

    private void initData() {
        appraisePresenter = new AppraisePresenter(this);
        appraisePresenter.findAppraise(childrenOrderId);
    }
}
